<?php

namespace app\common\model\Product;

use think\Model;
use think\Request;

// 物品分类
class Type extends Model
{
    protected $name = 'product_type';

    protected $autoWriteTimestamp = false;
    protected $updateTime = false;
    protected $createTime = false;

    protected $append = [
        'image_text', // 课程封面
    ];

    public function getImageTextAttr($value, $data)
    {
        // 获取当前域名
        $url = Request::instance()->domain();
        $image = !empty($data['image']) ? $url.$data['image'] :  $url.'/uploads/moren.png';

        return $image;
    }

}
